﻿/*
Copyright (c) 2009, Digiflare Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of Digiflare nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
using System.ServiceModel;

namespace Sharpmark.MarkTweet.Services.Twitter
{
    public class TwitterClient : ClientBase<ITwitterClient>, ITwitterClient
    {

        public static object LockMe;

        #region Constructor

        public TwitterClient(string username, string password)
        {
            LockMe = new object();
            base.ClientCredentials.UserName.UserName = username;
            base.ClientCredentials.UserName.Password = password;
        }

        #endregion

        #region Status Methods

        public Statuses PublicTimeline()
        {
            lock (LockMe)
            {
                return base.Channel.PublicTimeline();
            }
        }

        public Statuses FriendsTimeline()
        {
            lock (LockMe)
            {
                return base.Channel.FriendsTimeline();
            }
        }

        public Statuses FriendsTimelineSince(string sinceId)
        {
            lock (LockMe)
            {
                return base.Channel.FriendsTimelineSince(sinceId);
            }
        }

        public Statuses FriendsTimelineUntil(string maxId)
        {
            lock (LockMe)
            {
                return base.Channel.FriendsTimelineUntil(maxId);
            }
        }

        public Statuses UserTimeline()
        {
            lock (LockMe)
            {
                return base.Channel.UserTimeline();
            }
        }

        public Statuses UserTimelineById(string id)
        {
            lock (LockMe)
            {
                return base.Channel.UserTimelineById(id);
            }
        }

        public Status ShowStatus(string id)
        {
            lock (LockMe)
            {
                return base.Channel.ShowStatus(id);
            }
        }

        public Status Update(string status)
        {
            lock (LockMe)
            {
                return base.Channel.Update(status);
            }
        }

        public Status UpdateWithSource(string status, string source)
        {
            lock (LockMe)
            {
                return base.Channel.UpdateWithSource(status, source);
            }
        }

        public Status Update(string status, string id)
        {
            lock (LockMe)
            {
                return base.Channel.Update(status, id);
            }
        }

        public Status UpdateWithSource(string status, string id, string source)
        {
            lock (LockMe)
            {
                return base.Channel.UpdateWithSource(status, id, source);
            }
        }

        public Statuses Replies()
        {
            lock (LockMe)
            {
                return base.Channel.Replies();
            }
        }

        public Statuses Replies(string sinceId)
        {
            lock (LockMe)
            {
                return base.Channel.Replies(sinceId);
            }
        }

        public Status DestroyStatus(string id)
        {
            lock (LockMe)
            {
                return base.Channel.DestroyStatus(id);
            }
        }

        #endregion

        #region User Methods

        public Users Friends()
        {
            lock (LockMe)
            {
                return base.Channel.Friends();
            }
        }

        public Users Friends(string id)
        {
            lock (LockMe)
            {
                return base.Channel.Friends(id);
            }
        }

        public Users Followers()
        {
            lock (LockMe)
            {
                return base.Channel.Followers();
            }
        }

        public Users Followers(string id)
        {
            lock (LockMe)
            {
                return base.Channel.Followers(id);
            }
        }

        public User ShowUser(string id)
        {
            lock (LockMe)
            {
                return base.Channel.ShowUser(id);
            }
        }

        #endregion

        #region Direct Message Methods

        public DirectMessages DirectMessages()
        {
            lock (LockMe)
            {
                return base.Channel.DirectMessages();
            }
        }

        public DirectMessages DirectMessages(string sinceId)
        {
            lock (LockMe)
            {
                return base.Channel.DirectMessages(sinceId);
            }
        }

        public DirectMessages Sent()
        {
            lock (LockMe)
            {
                return base.Channel.Sent();
            }
        }

        public DirectMessage New(string user, string text)
        {
            lock (LockMe)
            {
                return base.Channel.New(user, text);
            }
        }

        public DirectMessage DestroyDirectMessage(string id)
        {
            lock (LockMe)
            {
                return base.Channel.DestroyDirectMessage(id);
            }
        }

        #endregion

        #region Friendship Methods
        #endregion

        #region Account Methods

        public User VerifyCrednetials()
        {
            lock (LockMe)
            {
                return base.Channel.VerifyCrednetials();
            }
        }

        #endregion
    }
}
